package src.main.原型模式;

public class Person implements Cloneable {
    private String name;
    private int age;
    private String sex;

    public static void main(String[] args) throws Exception {
        Person p = new Person(23, "zhang");
        Person p1 = (Person) p.clone();
        System.out.println(p);
        System.out.println(p1);
    }

    public Person(int age, String name) {
        this.age = age;
        this.name = name;

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }
}
